package cn.biplam.test;

import cn.biplam.common.tools.TOOLS;
import cn.biplam.common.wrapper.ErrorMessage;
import cn.biplam.front.component.AjxResponse;
import cn.biplam.front.html.base.HtmlWindow;
import cn.biplam.front.template.base.Text;
import cn.biplam.front.template.control.FlatTable;

public class AjxTestVc extends AjxResponse{
	public static final String cId = "9000";
	
	public static final String aId = cId+"01";
	public static final String aId_b = cId+"02";
	public static final String Main = cId+"03";

	@Override
	protected HtmlWindow ajxGet() throws ErrorMessage {
		if(aId.equals(actionId)){
			return get();
		}else if(aId_b.equals(actionId)){
			return getb();
		}else if(Main.equals(actionId)){
			return getArithMain();
		}else{
			throw new ErrorMessage("AjxTestVc Error,actionId is not found:"+actionId);
		}
	}
	
	private HtmlWindow getArithMain() throws ErrorMessage{
//		ArithPanel panel = new ArithPanel(mUser,sHomeUrl);
//		panel.putAddParams("param1", "1001");
//		return panel.get();
		return null;
	}
	
	private HtmlWindow get() throws ErrorMessage{
		FlatTable ft = new FlatTable("AjxText","tt");
		for(int i=0;i<15;i++){
			ft.putTd(getZm(TOOLS.intToString(i)), i,0);
		}
		ft.setWidth("250");
		ft.setHeight("400");
		HtmlWindow win = ft.get();
		return win;
	}
	
	private HtmlWindow getb() throws ErrorMessage{
		FlatTable ft = new FlatTable("AjxText1","tt");
		for(int i=0;i<2;i++){
			HtmlWindow win = new Text(getZm(TOOLS.intToString(i))).get();
			if(i==0){
				//win.bind(Window_Event.OnClick,ArithPanel.coverNaiv());
			}else{
				//win.bind(Window_Event.OnClick,ArithPanel.enableNaiv());
			}
			ft.putTd(win, 0,i);
		}
		ft.setWidth("250");
		return ft.get();
	}
	
	private  String getZm(String zm){
		StringBuilder sb = new StringBuilder();
		for(int i=0;i<10;i++){
			sb.append(zm);
		}
		return sb.toString();
	}

}
